package com.xiangyang.controller;

import com.xiangyang.entity.Drugs;
import com.xiangyang.entity.dto.Result;
import com.xiangyang.entity.vo.MedicineGovernPage;
import com.xiangyang.service.IDrugsService;
import com.xiangyang.service.IMedicineGovernService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.annotation.RequestScope;

import java.awt.image.ImageProducer;
import java.util.Map;

@RestController
@RequestMapping("/MedicationManagement")
public class MedicineGovernController {
    @Autowired
    private IMedicineGovernService drugsService;
//    @PostMapping("/MedicationManagement/delete")
//    public String DeleteDrugMange(Long governId) {
//        return drugsService.DeleteDrugMange(governId);
//    }

    @PostMapping("/update")
    public Result UpdateDrugMange(Drugs drugId) {
        return Result.ok(drugsService.UpdateDrugMange(drugId));
    }

    @PostMapping("/select")
    public Result SelectDruMange() {
        return drugsService.selectDrugMange();
    }

//    @PostMapping ("/MedicationManagement/hidden")
//    public boolean hidenDrugMange(@RequestParam Long isHedden,@RequestParam Long drugId) {
//        System.out.println(isHedden);
//        System.out.println(drugId);
//        return drugsService.hidenDrugMange(isHedden,drugId);
//    }
//    @PostMapping ("/MedicationManagement/hidden")
//    public boolean hidenDrugMange(@RequestBody Map<String,Object> aaa) {
//        Long drugId = (Long) aaa.get("drugId");
//      Long isHedden= (Long) aaa.get("isHedden");
//        return drugsService.hidenDrugMange(isHedden,drugId);
//    }
    @PostMapping ("/hidden")
    public int hidenDrugMange(Long isHedden, Long drugId) {
        return drugsService.hidenDrugMange(isHedden,drugId);
    }
    @PostMapping("/GovernPage")
    public Result Govern(@RequestBody MedicineGovernPage medicineGovernPage) {
        return drugsService.Govern(medicineGovernPage);
    }
}

